<script>
/**
 * @desc 旅游路线列表里当个旅游路线单元
 * @prop {Object} data 单个旅游路线需要展示的基本信息集合
 * @prop {Stirng} data.id 唯一标识
 * @prop {String} data.name 名称
 * @prop {Array} data.labelList 标签列表
 * @prop {String} data.picture 封面图片
 * @prop {Boolean} data.isVisa 是否免签
 * @prop {Number} data.singlePersonPrice 价格(单人)
 */

export default {
  name: 'travel-item',
  props: {
    data: Object,
    handleClick: Function
  }
}
</script>

<template>
  <div class="travel-item" @click="handleClick">
    <img :src="'https://source.hilval.com'+data.picture" class="preview" mode="aspectFill">
    <p class="title">{{data.name}}</p>
    <p class="sub-title-bar">
      <span class="sub-title">{{data.labelList[0]}}</span>
      <span class="flog" v-if="data.isVisa">免签</span>
    </p>
    <p class="price">￥{{data.singlePersonPrice}}</p>
  </div>
</template>

<style lang="scss" scoped>
.travel-item {
  margin-bottom: 20px;
  padding-bottom: 10px;
  text-align: center;
  line-height: 1.2;
  background-color: #fff;

  .preview {
    display: block;
    width: 750rpx;
    height: 375rpx;
    background-color: #ccc;
  }

  .title {
    font-size: 20px;
  }

  .sub-title {
    font-size: 16px;
  }

  .price {
    color: $main-color;
    font-size: 20px;
    font-weight: bold;
  }

  .title,
  .sub-title,
  .price {
    margin: 10px 0;
  }

  .sub-title-bar {
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .flog {
    display: inline-block;
    padding: 2px 4px;
    margin-left: 5px;
    color: #ff4700;
    font-size: 14px;
    border-radius: 5px;
    border: 1px solid #ff4700;
  }
}
</style>

